package cool.lichuan.project.system.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author lichuan
 * @date 2021/12/7 12:53
 * @description 系统访问记录
 */
@Data
@TableName(value = "sys_login_log")
public class LoginLog implements Serializable {
    /**
     * 访问ID
     */
    @TableId(value = "log_id", type = IdType.AUTO)
    private String logId;

    /**
     * token值
     */
    @TableField(value = "token_value")
    private String tokenValue;

    /**
     * 用户ID
     */
    @TableField(value = "user_id")
    private Long userId;

    /**
     * 用户昵称
     */
    @TableField(value = "nick_name")
    private String nickName;

    /**
     * 登录IP地址
     */
    @TableField(value = "ipaddr")
    private String ipaddr;

    /**
     * 登录地点
     */
    @TableField(value = "login_location")
    private String loginLocation;

    /**
     * 浏览器类型
     */
    @TableField(value = "browser")
    private String browser;

    /**
     * 引擎类型
     */
    @TableField(value = "engine")
    private String engine;

    /**
     * 操作系统
     */
    @TableField(value = "os")
    private String os;

    /**
     * 平台类型
     */
    @TableField(value = "platform")
    private String platform;

    /**
     * 是否为移动端 0是 1否
     */
    @TableField(value = "mobile")
    private String mobile;

    /**
     * 登录状态（0成功 1失败）
     */
    @TableField(value = "`status`")
    private String status;

    /**
     * 账号类型
     */
    @TableField(value = "login_type")
    private String loginType;

    /**
     * 操作类型 0登陆 1注销
     */
    @TableField(value = "oper_type")
    private String operType;

    /**
     * 访问时间
     */
    @TableField(value = "login_time")
    private LocalDateTime loginTime;

    /**
     * 部门名称
     */
    @TableField(value = "dept_name")
    private String deptName;

    public LoginLog(String tokenValue, Long userId, String nickName, String ipaddr, String loginLocation, String browser, String engine, String os, String platform, String mobile, String loginType, LocalDateTime loginTime, String deptName) {
        this.tokenValue = tokenValue;
        this.userId = userId;
        this.nickName = nickName;
        this.ipaddr = ipaddr;
        this.loginLocation = loginLocation;
        this.browser = browser;
        this.engine = engine;
        this.os = os;
        this.platform = platform;
        this.mobile = mobile;
        this.loginType = loginType;
        this.loginTime = loginTime;
        this.deptName = deptName;
    }

    private static final long serialVersionUID = 1L;
}